VPLAY-12682:SoC-independent underflow detection - follow-up improvements#1024
VPLAY-12682:SoC-independent underflow detection - follow-up improvements#1024varshnie wants to merge 3 commits intodev_sprint_25_2from
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request implements follow-up improvements to the AampUnderflowMonitor feature, focusing on lifecycle management changes and code simplification. However, the PR introduces critical thread-safety issues by removing mutex protections that were essential for safe concurrent access.
Changes:
- Moved AampUnderflowMonitor initialization from lazy creation in StartUnderflowMonitor to eager creation in StreamAbstractionAAMP constructor
- Removed mUnderflowMonitorMutex from StreamAbstractionAAMP class and all lifecycle method synchronization
- Cached raw pointers in AampUnderflowMonitor::Run() method to avoid repeated mutex locking
- Renamed parameter from bufferingStopped to bufferingStart for clarity
- Added config check wrapper around SetBufferingState logic
- Moved StartUnderflowMonitor calls from central TuneHelper to protocol-specific Start() methods
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| streamabstraction.cpp | Moved monitor initialization to constructor; removed mutex protections from lifecycle methods; simplified StartUnderflowMonitor |
| StreamAbstractionAAMP.h | Removed mUnderflowMonitorMutex member variable |
| priv_aamp.h | Renamed parameter bufferingStopped to bufferingStart in SendBufferChangeEvent |
| priv_aamp.cpp | Updated parameter name; added ReportBufferEvent config check wrapping SetBufferingState logic; removed monitor startup from TuneHelper |
| AampUnderflowMonitor.h | Removed @fn tags from Doxygen comments |
| AampUnderflowMonitor.cpp | Cached mAamp and mStream pointers locally in Run(); removed mutex protections from multiple pointer accesses |
| fragmentcollector_progressive.cpp | Added StartUnderflowMonitor call to protocol-specific Start() method |
| fragmentcollector_mpd.cpp | Added StartUnderflowMonitor call to protocol-specific Start() method |
| fragmentcollector_hls.cpp | Added StartUnderflowMonitor call to protocol-specific Start() method |
| AampConfig.cpp | Added documentation comment for enableAampUnderflowMonitor config option |
Comments suppressed due to low confidence (1)
streamabstraction.cpp:3043
- Missing synchronization: The removal of the mutex lock from StopUnderflowMonitor creates a race condition with StartUnderflowMonitor and IsUnderflowMonitorRunning(). Without the mutex, concurrent access to mUnderflowMonitor (checking, calling methods, and resetting) is not thread-safe.
Re-introduce the mUnderflowMonitorMutex to protect access to mUnderflowMonitor in all three lifecycle methods.
if (mUnderflowMonitor)
{
mUnderflowMonitor->Stop();
mUnderflowMonitor.reset();
AAMPLOG_INFO("Stopped AampUnderflowMonitor for video");
}
58f23ec to
025049b
Compare
025049b to
861853a
Compare
861853a to
a35fd92
Compare
a35fd92 to
dea5fb9
Compare
dea5fb9 to
0f5d441
Compare
0f5d441 to
70b421a
Compare
70b421a to
799335c
Compare
799335c to
700053b
Compare
test/utests/tests/StreamAbstractionAAMP/AampUnderflowMonitorTests.cpp
Outdated
Show resolved
Hide resolved
test/utests/tests/StreamAbstractionAAMP/AampUnderflowMonitorTests.cpp
Outdated
Show resolved
Hide resolved
test/utests/tests/StreamAbstractionAAMP/AampUnderflowMonitorTests.cpp
Outdated
Show resolved
Hide resolved
test/utests/tests/StreamAbstractionAAMP/AampUnderflowMonitorTests.cpp
Outdated
Show resolved
Hide resolved
700053b to
2bd4db9
Compare
test/utests/tests/StreamAbstractionAAMP/AampUnderflowMonitorTests.cpp
Outdated
Show resolved
Hide resolved
test/utests/tests/StreamAbstractionAAMP/AampUnderflowMonitorTests.cpp
Outdated
Show resolved
Hide resolved
2bd4db9 to
12bfdcf
Compare
12bfdcf to
dc36a2a
Compare
dc36a2a to
96f202d
Compare
96f202d to
739b3b0
Compare
739b3b0 to
0e89ff1
Compare
0e89ff1 to
b1f7e34
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
test/utests/fakes/FakeAampUnderflowMonitor.cpp:54
- This fake file defines the production
AampUnderflowMonitormethods (ctor/dtor/Start/Stop/Run). Because thefakeslibrary is linked by most unit test executables, any test that also compiles the realAampUnderflowMonitor.cppwill hit ODR / multiple-definition linker failures. Consider renaming this to a separate fake class (instead of redefiningAampUnderflowMonitor), or moving it out of the always-linkedfakeslibrary so only specific tests override the implementation.
#include "AampUnderflowMonitor.h"
#include "MockAampUnderflowMonitor.h"
MockAampUnderflowMonitor *g_mockAampUnderflowMonitor = nullptr;
AampUnderflowMonitor::AampUnderflowMonitor(StreamAbstractionAAMP* stream, PrivateInstanceAAMP* aamp) : mStream(stream), mAamp(aamp)
{
}
AampUnderflowMonitor::~AampUnderflowMonitor()
{
}
void AampUnderflowMonitor::Start()
{
mRunning.store(true);
if(g_mockAampUnderflowMonitor != nullptr)
{
g_mockAampUnderflowMonitor->Start();
}
}
void AampUnderflowMonitor::Stop()
{
mRunning.store(false);
if(g_mockAampUnderflowMonitor != nullptr)
{
g_mockAampUnderflowMonitor->Stop();
}
}
void AampUnderflowMonitor::Run()
{
}
b1f7e34 to
1e51788
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
StreamAbstractionAAMP.h:2042
mUnderflowMonitoris astd::unique_ptrthat is started/stopped and also reset in the implementation, and the class-level mutex that previously serialized these operations was removed. Given the monitor pointer can now be reset, this member needs explicit synchronization (or a stable lifetime guarantee) to avoid races when accessed from multiple threads via the public Start/Stop/IsRunning wrappers.
protected:
/**
* Underflow monitor instance owned by Stream; manages detection and
* handling of underflow conditions.
*/
std::unique_ptr<class AampUnderflowMonitor> mUnderflowMonitor;
Reason for change:follow-up improvements for AampUnderflowMonitor Risks: Medium Signed-off-by: varshnie <varshniblue14@gmail.com> VPLAY-12605:[L1 Test] AampUnderflowMonitor Tests Reason for change:Added L1 for AampUnderflowMonitor Test Procedure:Refer Jira Ticket Risks: Medium Signed-off-by: varshnie <varshniblue14@gmail.com> Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tionAAMP without stopping the underflow monitor first. Signed-off-by: Philip Stroffolino <philip_stroffolino@cable.comcast.com>
…monitor in streamabstarction stop
8fdc204 to
57735dc
Compare
Reason for change:follow-up improvements for AampUnderflowMonitor
Risks: Medium
Signed-off-by: varshnie varshniblue14@gmail.com